Migrating to const/let and Object Spread in more places#11535
Migrating to const/let and Object Spread in more places#11535gaearon merged 2 commits intofacebook:masterfrom
Conversation
fe1a6e7 to
669a157
Compare
| }; | ||
|
|
||
| var didWarn = {}; | ||
| let didWarn = {}; |
There was a problem hiding this comment.
This can probably be a const, since it's never re-assigned.
| var ancestorInfo = Object.assign({}, oldInfo || emptyAncestorInfo); | ||
| var info = {tag: tag, instance: instance}; | ||
| const updatedAncestorInfo = function(oldInfo, tag, instance) { | ||
| let ancestorInfo = {...{}, ...(oldInfo || emptyAncestorInfo)}; |
|
|
||
| // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
| var specialTags = [ | ||
| let specialTags = [ |
|
|
||
| var value = props.value; | ||
| var initialValue = value; | ||
| let initialValue = props.value; |
There was a problem hiding this comment.
Hmm, wonder why it was written the other way initially. 😛
There was a problem hiding this comment.
te-hehe
Do you recommend putting it back?
I think it does not make sense to keep this line. Since it is the same reference.
Tradeoff: I guess it was written for better readability.
What do you think @clemmy
There was a problem hiding this comment.
I think this is probably fine.
| }); | ||
| const hostProps = { | ||
| ...props, | ||
| ...{ |
There was a problem hiding this comment.
How about:
const hostProps = {
...props,
value: undefined,
defaultValue: undefined,
children: '' + node._wrapperState.initialValue,
};
| var hostProps = Object.assign({children: undefined}, props); | ||
|
|
||
| var content = flattenChildren(props.children); | ||
| const hostProps = {...{children: undefined}, ...props}; |
There was a problem hiding this comment.
Similar:
const hostProps = {children: undefined, ...props};
clemmy
left a comment
There was a problem hiding this comment.
Let me know if the comments I made make sense. :)
* Convert ReactDOMFiberTextarea to const/let * Convert ReactDOMSelection to const/let * Convert setTextContent to const/let * Convert validateDOMNesting to const/let
* Convert ReactDOMFiberOption to Object Spread * Convert ReactDOMFiberTextarea to Object Spread * Convert validateDOMNesting to Object Spread
|
Makes a lot of sense :D |
* Use const/let in more places (facebook#11467) * Convert ReactDOMFiberTextarea to const/let * Convert ReactDOMSelection to const/let * Convert setTextContent to const/let * Convert validateDOMNesting to const/let * Replace Object.assign by Object Spread * Convert ReactDOMFiberOption to Object Spread * Convert ReactDOMFiberTextarea to Object Spread * Convert validateDOMNesting to Object Spread
Uh oh!
There was an error while loading. Please reload this page.